package com.hm.email.auto;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter;

import com.hm.email.share.service.SendEmailService;

/**
 * @author shishun.wang
 * @date 下午3:32:26 2016年7月5日
 * @version 1.0
 * @describe 
 */
@Configuration
@EnableConfigurationProperties({ EmailProperties.class })
public class EmailAutoConfiguration {
	
	@Autowired
	private BeanFactory beanFactory;

	@Bean(name = SendEmailService.HTTP_INVOKER_EXPORT_CONTEXT)
	public HttpInvokerServiceExporter dbDocumentDeleteRecycleService() {
		HttpInvokerServiceExporter httpInvokerServiceExporter = new HttpInvokerServiceExporter();
		httpInvokerServiceExporter.setServiceInterface(SendEmailService.class);
		httpInvokerServiceExporter.setService(beanFactory.getBean(SendEmailService.class));
		httpInvokerServiceExporter.afterPropertiesSet();
		return httpInvokerServiceExporter;
	}
}
